package com.weipai.springboot.model.api;

import java.util.List;

public class PageResult<T> {

    public PageResult(){}
    public PageResult(List<T> list, Integer pageNum, Integer numPerPage, Integer totalCount, String draw){
        this.Obj=list;
        this.pageNum=pageNum;
        this.numPerPage=numPerPage;
        this.totalCount=totalCount;
        this.totalPage=totalCount/numPerPage+1;
        this.draw = draw;
    }
    public PageResult(List<T> list, String pageNum, String currentPage, Integer numPerPage, Integer totalCount, String draw){
        this.Obj=list;
        this.pageNum=pageNum(pageNum,currentPage);
        this.numPerPage=numPerPage;
        this.totalCount=totalCount;
        this.totalPage=totalCount/numPerPage+1;
        this.draw = draw;
    }

    private Integer pageNum;//页数

    private Integer numPerPage;//每页的数量

    private Integer totalCount;//总数量

    private Integer totalPage;//总页数

    private List<T> Obj;
    
    private String draw;

    public String getDraw() {
        return draw;
    }

    public void setDraw(String draw) {
        this.draw = draw;
    }

    public List<T> getObj() {
        return Obj;
    }

    public void setObj(List<T> obj) {
        Obj = obj;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getNumPerPage() {
        return numPerPage;
    }

    public void setNumPerPage(Integer numPerPage) {
        this.numPerPage = numPerPage;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    private Integer pageNum(String pageNum,String currentPage){

        return (Integer.parseInt(pageNum)-1) * Integer.parseInt(currentPage);
    }


}
